
D_AARCH64_BASEAPI_FLAGS= \
	-DOS_LINUX_SOC \
	-D__STDC_FORMAT_MACROS \
	-DCONFIG_MSPROTOCOL_MSAV \
	-DOS_PLATFORM_ARM64 \
	-DSOC_PLATFORM_RK3399

D_AARCH64_LIBMSLOG_LIBS 	:=`pkg-config --libs	libmslog_aarch64`
D_AARCH64_LIBMSLOG_INCLUDES 	:=`pkg-config --cflags	libmslog_aarch64`
D_AARCH64_LIBMSCOMMON_LIBS 	:=`pkg-config --libs	libmscommon_aarch64`
D_AARCH64_LIBMSCOMMON_INCLUDES 	:=`pkg-config --cflags	libmscommon_aarch64`
D_AARCH64_LIBPROTOCOL_LIBS 	:=`pkg-config --libs	libmsprotocol_aarch64`
D_AARCH64_LIBPROTOCOL_INCLUDES 	:=`pkg-config --cflags	libmsprotocol_aarch64`
D_AARCH64_FFMPEG_LIBS= \
	`pkg-config --libs libavcodec_aarch64` \
	`pkg-config --libs libavfilter_aarch64` \
	`pkg-config --libs libavformat_aarch64` \
	`pkg-config --libs libavutil_aarch64` \
	`pkg-config --libs libswresample_aarch64` \
	`pkg-config --libs libswscale_aarch64`
D_AARCH64_FFMPEG_INCLUDES= \
	`pkg-config --cflags libavcodec_aarch64` \
	`pkg-config --cflags libavfilter_aarch64` \
	`pkg-config --cflags libavformat_aarch64` \
	`pkg-config --cflags libavutil_aarch64` \
	`pkg-config --cflags libswresample_aarch64` \
	`pkg-config --cflags libswscale_aarch64`
	
##aarch64
C_AARCH64_INCLUDE	:=${D_AARCH64_LIBMSLOG_INCLUDES} ${D_AARCH64_LIBMSCOMMON_INCLUDES} ${D_AARCH64_FFMPEG_INCLUDES} ${D_AARCH64_BASEAPI_FLAGS} -Isrc 
C_AARCH64_LIBS		:=${D_AARCH64_LIBMSLOG_LIBS}     ${D_AARCH64_LIBMSCOMMON_LIBS}     ${D_AARCH64_FFMPEG_LIBS}     -pthread -lm  
libmsprotocol_aarch64_CC=aarch64-linux-gnu-gcc
libmsprotocol_aarch64_SRC=${C_SRC}
libmsprotocol_aarch64_CFLAGS=${C_AARCH64_INCLUDE} ${C_AARCH64_LIBS} ${CFLAGS_SHARE} -fPIC

msprotocol_api_sample_aarch64_CC=aarch64-linux-gnu-gcc
msprotocol_api_sample_aarch64_SRC=${C_SRC} msprotocol_api_sample.c
msprotocol_api_sample_aarch64_CFLAGS= ${D_AARCH64_LIBPROTOCOL_LIBS} ${D_AARCH64_LIBPROTOCOL_INCLUDES} ${C_AARCH64_INCLUDE} ${C_AARCH64_LIBS}

msprotocol_api_test_aarch64_CC=aarch64-linux-gnu-gcc
msprotocol_api_test_aarch64_SRC=${C_SRC} msprotocol_api_test.c
msprotocol_api_test_aarch64_CFLAGS=   ${D_AARCH64_LIBPROTOCOL_LIBS} ${D_AARCH64_LIBPROTOCOL_INCLUDES} ${C_AARCH64_INCLUDE} ${C_AARCH64_LIBS}

aarch64:libmsprotocol_aarch64  sample_aarch64 install_aarch64

libmsprotocol_aarch64: 
	mkdir -p $(OUT_LIB)
	mkdir -p $(OUT_INCLUDE)
	cp -fr src/*.h $(OUT_INCLUDE)
	$($@_CC)  $($@_SRC)  $($@_CFLAGS)  -o $(OUT_LIB)/$(PROGRAM_NAME).so 

sample_aarch64: msprotocol_api_sample_aarch64  msprotocol_api_test_aarch64

msprotocol_api_sample_aarch64: 
	mkdir -p $(OUT_BIN)
	$($@_CC)  $($@_SRC)  $($@_CFLAGS)  -o $(OUT_BIN)/$@ 
	cp $(OUT_BIN)/$@ 	${prefix_aarch64}/bin/mscore_mctu -fr
msprotocol_api_test_aarch64: 
	mkdir -p $(OUT_BIN)
	$($@_CC)  $($@_SRC)  $($@_CFLAGS) -g -o out/bin/$@ 
	cp $(OUT_BIN)/$@ 	${prefix_aarch64}/bin/mscore_test_concurrent -fr

install_aarch64: 
	mkdir -p  ${prefix_aarch64}/lib/ 
	mkdir -p  ${prefix_aarch64}/include/   
	mkdir -p  ${prefix_aarch64}/lib/pkgconfig/ 
	cp    -fr $(OUT_LIB)/$(PROGRAM_NAME).so	${prefix_aarch64}/lib/     
	cp    -fr $(OUT_INCLUDE)			${prefix_aarch64}/include/	     
	cp    -fr platform/$(PROGRAM_NAME)_aarch64.pc	${prefix_aarch64}/lib/pkgconfig/

uninstall_aarch64:
	rm -fr ${prefix_aarch64}/lib/$(PROGRAM_NAME).so 
	rm -fr ${prefix_aarch64}/include/$(PROGRAM_NAME)
	rm -fr ${prefix_aarch64}/lib/pkgconfig/$(PROGRAM_NAME)_aarch64.pc
	rm -fr ${prefix_aarch64}/bin/mscore_mctu
	rm -fr ${prefix_aarch64}/bin/mscore_test_concurrent
